package controllers

import (
	"fmt"
	"math/rand"
	"net/http"
	"time"

	"gitee.com/linxunsdut/cncf01/metrics"
)

func Detail(w http.ResponseWriter, r *http.Request) {
	timer := metrics.NewTimer()
	defer timer.ObserveTotal()
	randInt := rand.Intn(2000)
	time.Sleep(time.Millisecond * time.Duration(randInt))
	respContent := fmt.Sprintf("response time: %d ", randInt)
	w.Write([]byte(respContent))
}
